import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.util.Locale;
import java.util.Scanner;
import java.time.*;

public class JavaIorO {
    public static void main(String[] args)throws IOException
    {
        int quan=1;
        if(quan==0)
        {


        }
        else if(quan==1)
        {
            var staff =new Employee[3];
            staff[0]=new Employee("a",7500,1987,12,15);
            staff[1]=new Employee("b",5000,1989,10,15);
            staff[2]=new Employee("c",4500,1990,11,15);
            try(var out=new PrintWriter("employee.dat", StandardCharsets.UTF_8)) {

                writeData(staff,out);
            }
            try(var in=new Scanner(new FileInputStream("employee.dat"),"UTF-8"))
            {
                Employee[] newStaff=readData(in);
                for(Employee e:newStaff) System.out.println(e);
            }
        }


    }
    private  static void writeData(Employee[] employees, PrintWriter out)
    {
        out.println(employees.length);
        for (Employee e: employees)
        {writeEmployee(out,e);}
    }
    private static Employee[] readData(Scanner in)
    {
        int n=in.nextInt();
        System.out.println(n);
        in.nextLine();
        var employees=new Employee[n];
        for(int i=0;i<n;++i)
        {
            employees[i]=readEmployee(in);
        }
        return employees;
    }
    public  static void writeEmployee(PrintWriter out,Employee e)
    {
        out.println(e.getName()+"|"+e.getSalary()+"|"+e.getHireDay());
    }
    public static Employee readEmployee(Scanner in)
    {
        String line=in.nextLine();
        String[] tokens=line.split("\\|");
        for(String a:tokens) System.out.println(a);
        String name=tokens[0];
        double salary=Double.parseDouble(tokens[1]);
        LocalDate hireDate=LocalDate.parse(tokens[2]);
        int year=hireDate.getYear();
        int month=hireDate.getMonthValue();
        int day=hireDate.getDayOfMonth();
        // System.out.println(year+""+month+""+day);
        return  new Employee(name,salary,year,month,day);
    }
}
